package ee.karileet.productcatalogue.service.impl;

import ee.karileet.productcatalogue.dao.IManufactorHome;
import ee.karileet.productcatalogue.dao.impl.ManufactorHome;
import ee.karileet.productcatalogue.model.Manufactor;
import ee.karileet.productcatalogue.service.IManufactor;

public class ManufactorSrv implements IManufactor {
	
	private IManufactorHome home;
	
	public ManufactorSrv() {
		home = new ManufactorHome();
	}
	
	public boolean addManufactor(Manufactor manufactor) {
		// TODO Auto-generated method stub
		return false;
	}

	public Manufactor getManufactor(int manufactorId) throws Exception {
		if (!(manufactorId > 0)) throw new Exception("ID must be greater than 0");
		return home.findById(manufactorId);
	}

	public java.util.Set<Manufactor> listManufactors() {
		return new java.util.HashSet<Manufactor>(home.findAll());
	}

	public void removeManufactor(int manufactorId) throws Exception {
		if (!(manufactorId > 0)) throw new Exception("ID must be greater than 0");
		Manufactor m = home.findById(manufactorId);
		home.delete(m);
	}

	public boolean updateManufactor(Manufactor manufactor) {
		// TODO Auto-generated method stub
		return false;
	}

}
